<?php
	require_once($GLOBALS['BIB'].'Pr_db/pr_historics.mex');
	$RegID = 0;

	$_POST['smb_CttEmail'] = req_form($_POST['smb_CttEmail']);
	$_POST['smb_CttPhone'] = req_form($_POST['smb_CttPhone']);
	$_POST['smb_CttAddress'] = req_form($_POST['smb_CttAddress']);
	$_POST['smb_DocNumber'] = req_form($_POST['smb_DocNumber']);
	$_POST['smb_SSID'] = req_form($_POST['smb_SSID']);
	$_POST['smb_Dependentes'] = req_form($_POST['smb_Dependentes']);
	$_POST['smb_Habilitacoes'] = req_form($_POST['smb_Habilitacoes']);
	$_POST['smb_DocLocal'] = req_form($_POST['smb_DocLocal']);

	if ($_POST['smb_DocID'] == '') { $_POST['smb_DocID'] = 0; }
	
	if ($_POST['smb_ID'] > 0) { 
	if (!isset($_POST['smb_DocDate'])) { $_POST['smb_DocDate'] = ''; }
	$date1 = date_dbformat($_POST['smb_Birthdate']);
	$date2 = date_dbformat($_POST['smb_DocDate']);
	$date3 = date_dbformat($_POST['smb_DocValid']);
	

		$PID = 400;
		if($GLOBALS['MYT']->db_query("UPDATE systemoffice.staff_members 
				SET
				smb_Name = '{$_POST['smb_Name']}', 
				smb_Birthdate = '{$date1}',
				smb_CttEmail = '{$_POST['smb_CttEmail']}',
				smb_CttPhone = '{$_POST['smb_CttPhone']}',
				smb_CttAddress = '{$_POST['smb_CttAddress']}', 
				smb_DocID = {$_POST['smb_DocID']}, 
				smb_DocNumber = '{$_POST['smb_DocNumber']}', 
				smb_SSID = '{$_POST['smb_SSID']}', 
				smb_Nacionalidade = '{$_POST['smb_Nacionalidade']}', 
				smb_Civil = '{$_POST['smb_Civil']}', 
				smb_Dependentes = '{$_POST['smb_Dependentes']}', 
				smb_Habilitacoes = '{$_POST['smb_Habilitacoes']}', 
				smb_DocDate = '{$date2}', 
				smb_DocValid = '{$date3}', 
				smb_DocLocal = '{$_POST['smb_DocLocal']}', 
				smb_NIF = '{$_POST['smb_NIF']}'
				WHERE smb_ID = {$_POST['smb_ID']}")==true) {
				systemchange_hs('STAFFMEMBER_CHANGE',$_POST['smb_ID']);
					echo '<div class="Confirm">Guardado.</div>';
				if ($RegID != 0) {
				include($GLOBALS['BIB'].'Pr_db/prc_modules/rh_comunication.php');
				}
		} else {
			echo '<div class="Error">Erro.</div>';
		}
	}


